const userDao = require('../dao/userDao');
// 登录
module.exports.loginUser = async function (user) {
    // console.log('user:',user);
    return await userDao.findUser(user);
}
module.exports.findUser = async function (searchObj, page) {
    return await userDao.find(searchObj, page);
};
module.exports.createUser = async function (user) {
    return await userDao.create(user);
};

module.exports.removeUser = async function (id) {
    return await userDao.remove(id);
}

module.exports.findById = async function (id) {
    return await userDao.findById(id);
}
module.exports.updateUser = async function (id, user) {
    return await userDao.update({ _id: id }, user);
}

// 验证用户名是否存在
module.exports.usernameExist = async function (username) {
    return await userDao.findByUsername(username);
}